add nmk power cut off result#980
Conversation
|
Warning Review limit reached
More reviews will be available in 56 minutes and 15 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds NMK_CUT_OFF_POWER to SecurityAnalysisResultType, maps it in SecurityAnalysisService to paged and CSV export endpoints, and extends tests and WireMock helpers to cover the new result type. ChangesNMK_CUT_OFF_POWER Result Type Support
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
etiennehomer
left a comment
There was a problem hiding this comment.
Add a small test in SecurityAnalysisTest
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/test/java/org/gridsuite/study/server/rootnetworks/SecurityAnalysisTest.java (1)
370-392: 💤 Low valueUse a dedicated CSV payload constant for the cut-off-power assertion.
The new stub and
assertArrayEqualsboth reuseSECURITY_ANALYSIS_NMK_CONSTRAINTS_RESULT_CSV_ZIPPED. The routing assertion (distinct URL +verifyPostResultCsv("nmk-cut-off-power-result")) is sound, but reusing the constraints payload means the body assertion can't actually distinguish cut-off-power output from the constraints case. A dedicated constant makes the test self-documenting and catches accidental payload cross-wiring.♻️ Proposed change
+ private static final byte[] SECURITY_ANALYSIS_NMK_CUT_OFF_POWER_RESULT_CSV_ZIPPED = {0x05, 0x03};.willReturn(aResponse() .withStatus(200) .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_OCTET_STREAM_VALUE) - .withBody(SECURITY_ANALYSIS_NMK_CONSTRAINTS_RESULT_CSV_ZIPPED) + .withBody(SECURITY_ANALYSIS_NMK_CUT_OFF_POWER_RESULT_CSV_ZIPPED) ) ); @@ byteArrayResult = mvcResult.getResponse().getContentAsByteArray(); - assertArrayEquals(SECURITY_ANALYSIS_NMK_CONSTRAINTS_RESULT_CSV_ZIPPED, byteArrayResult); + assertArrayEquals(SECURITY_ANALYSIS_NMK_CUT_OFF_POWER_RESULT_CSV_ZIPPED, byteArrayResult); computationServerStubs.verifyPostResultCsv(SECURITY_ANALYSIS_RESULT_UUID, "nmk-cut-off-power-result");🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/org/gridsuite/study/server/rootnetworks/SecurityAnalysisTest.java` around lines 370 - 392, Create a dedicated CSV payload constant for the cut-off-power test instead of reusing SECURITY_ANALYSIS_NMK_CONSTRAINTS_RESULT_CSV_ZIPPED; define e.g. SECURITY_ANALYSIS_NMK_CUT_OFF_POWER_RESULT_CSV_ZIPPED and use that new constant in the WireMock stub (the POST to "/v1/results/.../nmk-cut-off-power-result/csv") and in the assertion that compares the response bytes (replace the assertArrayEquals expected value), leaving the routing verification via computationServerStubs.verifyPostResultCsv(...) unchanged so the test can distinguish constraints vs cut-off-power payloads.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@src/test/java/org/gridsuite/study/server/rootnetworks/SecurityAnalysisTest.java`:
- Around line 370-392: Create a dedicated CSV payload constant for the
cut-off-power test instead of reusing
SECURITY_ANALYSIS_NMK_CONSTRAINTS_RESULT_CSV_ZIPPED; define e.g.
SECURITY_ANALYSIS_NMK_CUT_OFF_POWER_RESULT_CSV_ZIPPED and use that new constant
in the WireMock stub (the POST to
"/v1/results/.../nmk-cut-off-power-result/csv") and in the assertion that
compares the response bytes (replace the assertArrayEquals expected value),
leaving the routing verification via
computationServerStubs.verifyPostResultCsv(...) unchanged so the test can
distinguish constraints vs cut-off-power payloads.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 68a82946-fa24-4399-9b97-b0d50bc4bc3b
📒 Files selected for processing (3)
src/main/java/org/gridsuite/study/server/service/SecurityAnalysisService.javasrc/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisResultType.javasrc/test/java/org/gridsuite/study/server/rootnetworks/SecurityAnalysisTest.java
|



PR Summary
add nmk power cut off result